home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 3
/
Cream of the Crop 3.iso
/
comm
/
_ter12b.zip
/
TER12B._XE
/
PASCAL.EXE
/
LSTPHONE.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1993-06-07
|
1KB
|
48 lines
Program ListPhoneBook;
{ A small Terminate utility to show how to use the phonebook }
{ Structures are Copyrighted by Bo Bendtsen 1992 }
{$I PHONE.100}
Var
PhoneFile : File;
x : Word;
Procedure FatalError(s:string);
Begin
WriteLn('Fatal: '+s+#10#10);
Halt;
End;
Begin
FillChar(PHead,Sizeof(PHead),0);
Assign(PhoneFile,'TERMINAT.FON');
{$I-} Reset(PhoneFile,1); {$I+}
If IOResult=0 Then
Begin
{ Read the header in the phone file }
{$I-} BlockRead(PhoneFile,PHead,Sizeof(PHead)); {$I+}
If IOResult<>0 Then FatalError('Error in start of phonebook');
{ Read all records into structure }
For x:=1 to PHead.Num Do
Begin
New(Ph[x]); { Reserve memory }
{$I-} BlockRead(PhoneFile,Ph[x]^.P,Sizeof(Ph[x]^.P)); {$I+}
If IOResult<>0 Then FatalError('Error in phonebook, maybe wrong version');
End;
Close(PhoneFile);
End;
{ Write all phonenumbers on screen }
For x:=1 to PHead.Num Do WriteLn(Ph[x]^.P.Name);
{ Free memory before exiting }
For x:=1 to PHead.Num Do Dispose(Ph[x]);
End.